package com.lq.demo.demo.mode.timer;

import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

/**
 * @Auther: LQ
 * @Date: 2018/10/15 21:27
 * @Description:
 */
@Slf4j
public class Exec {


    public static void main(String[] args) {
        Timer timer = new Timer();
        Calendar instance = Calendar.getInstance();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        log.info("now time  is {}", simpleDateFormat.format(instance.getTime()));

        DancingRebot dancingRebot = new DancingRebot();
        WaterRebot waterRebot = new WaterRebot(timer);
        timer.schedule(dancingRebot, instance.getTime(), 2000);

        timer.scheduleAtFixedRate(waterRebot, new Date(), 1000);



    }
}
